Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next |

Receiving Events

You can use the WaitNextEvent (WaitNextEvent) or GetNextEvent (GetNextEvent) function to retrieve an event from the Event Manager and remove the event from the event stream. To provide greater support for multitasking, however, you should use the WaitNextEvent function instead of GetNextEvent whenever possible. You can use the EventAvail function (EventAvail) to look at an event without removing it from the event stream. You can use the AcceptHighLevelEvent function (AcceptHighLevelEvent) to get additional information associated with a high-level event and GetSpecificHighLevelEvent (GetSpecificHighLevelEvent) to search for a specific high-level event.

The FlushEvents (FlushEvents) function removes all low-level events from the Operating System event queue. In general, your application should not empty the event queue.

You can use the SystemClick function (SystemClick) to route events to desk accessories when necessary. The SystemTask (SystemTask) and SystemEvent (SystemEvent) functions are used by the Event Manager, and your application usually does not need to call these two functions.

You usually use the functions provided by the Toolbox Event Manager to retrieve events from the event stream. Even if you are interested only in the events stored in the Operating System event queue, you can retrieve these events using the Toolbox Event Manager by setting the event mask to mask out all events except keyboard, mouse, and disk-inserted events. However, you can choose to use Operating System Event Manager functions to perform this task.

The Operating System Event Manager provides two functions, GetOSEvent (GetOSEvent) and OSEventAvail (OSEventAvail) , to retrieve events from the Operating System event queue. In most cases, your application will not need to use these two functions.

If your application needs to receive key-up events, you can change the system event mask of your application using the SetEventMask function (SetEventMask) . The GetEvQHdr function (GetEvQHdr) returns a pointer to the header of the Operating System event queue.

WaitNextEvent

You can use the WaitNextEvent function to retrieve events one at a time from the Event Manager.

pascal Boolean WaitNextEvent (EventMask eventMask,
                                          EventRecord *theEvent,
                                          UInt32 sleep,
                                          RgnHandle mouseRgn);
eventMask
A value that indicates which kinds of events are to be returned. This parameter is interpreted as a sum of event mask constants. You specify the event mask using values defined by the EventMask enumeration (Event Masks) . To accept all events, you can specify the everyEvent constant as the event mask.
If no event of any of the designated types is available, WaitNextEvent returns a null event. WaitNextEvent determines the next available event to return based on the eventMask parameter and the priority of the event.
Events not designated by the event mask remain in the event stream until retrieved by an application. Low-level events in the Operating System event queue are kept in the queue until they are retrieved by your application or another application or until the queue becomes full. Once the queue becomes full, the Operating System Event Manager begins discarding the oldest events in the queue.
theEvent
A pointer to an event record for the next available event of the specified type or types. The WaitNextEvent function removes the returned event from the event stream and returns the information about the event in an event record. The event record includes the type of event received and other information. See "The Event Record" for a description of the fields in the event record.
In addition to the event record, high-level events can contain additional data; you use the AcceptHighLevelEvent (AcceptHighLevelEvent) function or the Apple Event Manager AEProcessAppleEvent function to get additional data associated with these events.
sleep
The number of ticks (a tick is approximately 1/60 of a second) indicating the amount of time your application is willing to relinquish the processor if no events (other than null events) are pending for your application. If you specify a value greater than 0 for the sleep parameter, your application relinquishes the processor for the specified time or until an event occurs.
You should usually specify a value greater than 0 for the sleep parameter to allow background processes to receive processing time. You should not set the sleep parameter to a value greater than the number of ticks returned by GetCaretTime (GetCaretTime) if your application provides text-editing capabilities. When the specified time expires, and if there are no pending events for your application, WaitNextEvent returns a null event in the parameter theEvent .
mouseRgn
A handle to a region that specifies a region inside of which mouse movement does not cause mouse-moved events. In other words, your application receives mouse-moved events only when the cursor is outside the specified region. You should specify the region in global coordinates. If you pass an empty region or a nil region handle, the Event Manager does not report mouse-moved events to your application. Note that your application should recalculate the mouseRgn parameter when it receives a mouse-moved event, or it will continue to receive mouse-moved events as long as the cursor position is outside the original mouseRgn .
function result
The WaitNextEvent function returns false as its function result if the event being returned is a null event or if WaitNextEvent has intercepted the event; otherwise, WaitNextEvent returns true .

DESCRIPTION

The WaitNextEvent function calls the Operating System Event Manager function SystemEvent to determine whether the event should be handled by the application or the Operating System.

If no events are pending for your application, WaitNextEvent waits for a specified amount of time for an event. (During this time, processing time may be allocated to background processes.) If an event occurs, it is returned through the parameter theEvent , and WaitNextEvent returns a function result of true . If the specified time expires and there are no pending events for your application, WaitNextEvent returns a null event in theEvent and a function result of false .

Before returning an event to your application, WaitNextEvent performs other processing and may intercept the event.

The WaitNextEvent function intercepts Command-Shift-number key sequences and calls the corresponding ' FKEY ' resource to perform the associated action. The Event Manager's processing of Command-Shift-number key sequences with numbers 3 through 9 can be disabled by setting the ScrDmpEnable global variable (a byte) to 0.

The WaitNextEvent function also makes the alarm go off if the alarm is set and the current time is the alarm time. The user sets the alarm using the Alarm Clock desk accessory.

The WaitNextEvent function also calls the SystemTask function (SystemTask) , which gives time to each open desk accessory or device driver to perform any periodic action defined for it. A desk accessory or device driver specifies how often the periodic action should occur, and SystemTask gives time to the desk accessory or device driver at the appropriate interval.

Some high-level events may be fully specified by their event records only, while others may include additional information in an optional buffer. To get any additional information and to find the sender of the event, use the AcceptHighLevelEvent function (AcceptHighLevelEvent) .

If the returned event is a high-level event and your application supports Apple events, use the Apple Event Manager function AEProcessAppleEvent to respond to the Apple event and to get additional information associated with the Apple event.

SPECIAL CONSIDERATIONS

In System 7, if your application is in the foreground and the user opens a desk accessory or other item from the Apple menu, clicks in the window belonging to another application or desk accessory, or chooses another process from the Application menu, the next event reported to your application by the WaitNextEvent function is a suspend event. After your application is switched out, the Event Manager directs events (other than events your application can receive in the background) to the newly activated process until the user switches back to your application or another application.

In a single-application environment in System 6, and in a multiple- application environment in which the desk accessory is launched in the application's partition (for example, a desk accessory opened by the user from the Apple menu while holding down the Option key), the Event Manager handles events for desk accessories in a slightly different manner.

In these environments, when mouse-up, activate, update, and keyboard events (including keyboard equivalents of menu commands) occur, the Event Manager checks to see whether the active window belongs to a desk accessory and whether the desk accessory can handle the event. If so, it sends the event to the desk accessory and WaitNextEvent returns false to your application. Also note that in these environments, the Event Manager returns true for mouse-down events, regardless of whether the mouse-down event is for a desk accessory or not. For mouse-down events in these situations, if the mouse button was pressed while the cursor was in a desk accessory window (as indicated by the inSystem constant returned by the Window Manager FindWindow function), your application should call the SystemClick function (SystemClick) . The SystemClick function handles mouse-down events as appropriate for desk accessories, including sending your application an activate event to deactivate its front window if the desk accessory window needs to be activated.

SEE ALSO

To get information about the sender of a high-level event and to retrieve any additional data associated with the high-level event, use the AcceptHighLevelEvent function AcceptHighLevelEvent . For details on how to process an Apple event, see the description of the AEProcessAppleEvent function in Inside Macintosh: Interapplication Communication .

To retrieve an event without removing it from the event stream, use the EventAvail function (EventAvail) .

EventAvail

You can use the EventAvail function to retrieve the next available event from the Event Manager without removing the returned event from your application's event stream.

pascal Boolean EventAvail (EventMask eventMask,
                                         EventRecord *theEvent);
eventMask
A value that indicates which kinds of events are to be returned; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more of the values defined by the EventMask enumeration (Event Masks) . If no event of any of the designated types is available, EventAvail returns a null event.
theEvent
A pointer to an event record for the next available event of the specified type or types. The EventAvail function does not remove the returned event from the event stream, but does return the information about the event in an event record. The event record includes the type of event received and other information.
function result
EventAvail returns false as its function result if the event being returned is a null event; otherwise, EventAvail returns true .

DESCRIPTION

Like WaitNextEvent (WaitNextEvent) , the EventAvail function calls the SystemTask function (SystemTask) to give time to each open desk accessory or device driver to perform any periodic action defined for it. The EventAvail function also makes the alarm go off if the alarm is set and the current time is the alarm time. The user sets the alarm using the Alarm Clock desk accessory.

SPECIAL CONSIDERATIONS

If EventAvail returns a low-level event from the Operating System event queue, the event will not be accessible later if, in the meantime, the event queue becomes full and the event is discarded from it; however, this is not a common occurrence.

SEE ALSO

See "The Event Record" for a description of the fields in the event record.

GetNextEvent

Although you should normally use WaitNextEvent , you can also use the GetNextEvent function to retrieve events one at a time from the Event Manager.

pascal Boolean GetNextEvent (EventMask eventMask,
                                          EventRecord *theEvent);
eventMask
A value that indicates which kinds of events are to be returned; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more of the values defined by the EventMask enumeration (Event Masks) . If no event of any of the designated types is available, GetNextEvent returns a null event.
theEvent
A pointer to an event record for the next available event of the specified type or types. The GetNextEvent function removes the returned event from the event stream and returns the information about the event in an event record. The event record includes the type of event received and other information.

DESCRIPTION

GetNextEvent returns false as its function result if the event being returned is a null event or if GetNextEvent has intercepted the event; otherwise, GetNextEvent returns true . The GetNextEvent function calls the Operating System Manager function SystemEvent to determine whether the event should be handled by the application or the Operating System.

Like WaitNextEvent (WaitNextEvent) , the GetNextEvent function calls the SystemTask function SystemTask to give time to each open desk accessory or device driver to perform any periodic action defined for it. The GetNextEvent function also makes the alarm go off if the alarm is set and the current time is the alarm time. (The user sets the alarm using the Alarm Clock desk accessory.)

The GetNextEvent function also intercepts Command-Shift-number key sequences and calls the corresponding ' FKEY ' resource to perform the associated action. The Event Manager's processing of Command-Shift-number key sequences with numbers 3 through 9 can be disabled by setting the ScrDmpEnable global variable (a byte) to 0.

SPECIAL CONSIDERATIONS

For greater support of the multitasking environment, your application should use WaitNextEvent instead of GetNextEvent whenever possible. If your application does call GetNextEvent , it should also call the SystemTask function.

SEE ALSO

See "The Event Record" for a description of the fields in the event record.

AcceptHighLevelEvent

After receiving a high-level event (other than an Apple event), use the AcceptHighLevelEvent function to get any additional information associated with the event.

pascal OSErr AcceptHighLevelEvent (TargetID *sender,
                                         unsigned long *msgRefcon,
                                         void *msgBuff,
                                         unsigned long *msgLen);
sender
A pointer to a structure of type TargetID (The Target ID Structure) whose contents identify the sender of the event. The structure referenced through the sender parameter contains the session reference number that identifies the connection with the other application and the port name and location name of the sender.
msgRefcon
A pointer to a value that uniquely identifies the communication associated with this event. If you send a response to this event, you should specify the same value as that referenced through the msgRefcon parameter so that the sender of the event can associate the reply with the original request.
msgBuff
A pointer to a block of memory where the AcceptHighLevelEvent function should return any additional data associated with the event. Your application is responsible for allocating the memory for the additional data pointed to by the msgBuff parameter and for setting the msgLen parameter to the number of bytes that you have allocated for the data.
If the msgBuff parameter points to an area in memory that is not large enough to hold all the data associated with the event, AcceptHighLevelEvent returns as much data as the specified memory area can hold, returns the amount of data remaining in the msgLen parameter, and returns the result code bufferIsSmall .
msgLen
A pointer to a value that specifies the size of the data (in bytes) pointed to by the msgBuff parameter. If AcceptHighLevelEvent returns the result code bufferIsSmall , the value referenced through the msgLen parameter contains the number of bytes remaining. You can call AcceptHighLevelEvent again to receive the rest of the data.

DESCRIPTION

When your application receives a high-level event, you can use the AcceptHighLevelEvent function to get additional data associated with the event. The AcceptHighLevelEvent function returns information that identifies the sender of the event and the unique message reference constant of the event.

Your application should allocate memory for any additional data associated with the event, then supply a pointer to the data area and also provide the length in bytes of the data area.

SPECIAL CONSIDERATIONS

The AcceptHighLevelEvent function may move or purge memory. You should not call this function from within an interrupt, such as in a completion function or VBL task.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the AcceptHighLevelEvent function are

Trap macro

Selector

_OSDispatch

$0033

RESULT CODES

noErr

0

No error

bufferIsSmall

-607

Buffer is too small

noOutstandingHLE

-608

No outstanding high-level event

SEE ALSO

For details on how to process an Apple event using the AEProcessAppleEvent function, see Inside Macintosh: Interapplication Communication .

GetSpecificHighLevelEvent

You can use the GetSpecificHighLevelEvent function to select and optionally retrieve a specific high-level event from your application's high-level event queue.

pascal Boolean GetSpecificHighLevelEvent (
                                          GetSpecificFilterUPP aFilter,
                                          void *contextPtr,
                                          OSErr *err);
aFilter
A universal procedure pointer to the application-defined filter function that GetSpecificHighLevelEvent should use to search for a specific event; see "Filter Function Pointer and Macro" for details. GetSpecificHighLevelEvent calls your filter function once for each event in your application's high-level event queue until the function returns true or the end of the queue is reached.
contextPtr
A pointer to a value that specifies the criteria your filter function should use to select a specific event. For example, you can specify the address of a reference constant to search for a particular event, the address of a target ID structure to search for a specific sender of an event, or the address of an event class to search for a specific class of event.
err
GetSpecificHighLevelEvent returns, through this parameter, a value that indicates whether any errors occurred. The err parameter specifies the noErr constant if no errors occurred or noOutstandingHLE if no high-level events are pending in your application's high-level event queue.

DESCRIPTION

You can use the GetSpecificHighLevelEvent function to search for a specific high-level event in your application's high-level event queue. You specify a filter function as one of the parameters to GetSpecificHighLevelEvent . The GetSpecificHighLevelEvent function calls your filter function once for every event in your application's high-level event queue, until your filter function returns true or the end of the queue is reached.

The GetSpecificHighLevelEvent function passes the value referenced by the contextPtr parameter to your filter function. Your filter function also receives as parameters the event record associated with the high-level event and the target ID structure that identifies the sender of the event. Your filter function can compare the value referenced by the contextPtr parameter with any of the other information it receives.

If your filter function finds a match, it can call AcceptHighLevelEvent (AcceptHighLevelEvent) if necessary, and then return true . If your filter function does not find a match, then it should return false .

If your filter function returns true , the GetSpecificHighLevelEvent function returns true . If your filter function returns false for all high-level events in your application's event queue, or if there are no high-level events in the queue, GetSpecificHighLevelEvent returns false .

SPECIAL CONSIDERATIONS

The GetSpecificHighLevelEvent function may move or purge memory. You should not call this function from within an interrupt, such as in a completion routine or VBL task.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the GetSpecificHighLevelEvent function are

Trap macro

Selector

_OSDispatch

$0045

SEE ALSO

See "Filter Function for Searching the High-Level Event Queue" for more information about how to define a filter function and the parameters that GetSpecificHighLevelEvent passes to your filter function.

FlushEvents

The FlushEvents function removes low-level events from the Operating System event queue. Note that FlushEvents does not remove any types of events not stored in the Operating System event queue.

You can choose to use the FlushEvents function when your application first starts to empty the Operating System event queue of any keystrokes or mouse events generated by the user while the Finder loaded your application. In general, however, your application should not empty the queue at any other time as this loses user actions and makes your application and the computer appear unresponsive to the user.

pascal void FlushEvents (EventMask whichMask, EventMask stopMask);
whichMask
A value that indicates which kinds of low-level events are to be removed from the Operating System event queue; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more of the values defined by the EventMask enumeration (Event Masks) . The whichMask and stopMask parameters together specify which events to remove.
stopMask
A value that limits which low-level events are to be removed from the Operating System event queue; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more of the values defined by the EventMask enumeration (Event Masks) . FlushEvents does not remove any low-level events that are specified by the stopMask parameter. To remove all events specified by the whichMask parameter, specify 0 as the stopMask parameter.

DESCRIPTION

FlushEvents removes only low-level events stored in the Operating System event queue; it does not remove activate, update, operating-system, or high-level events.

You specify which low-level events to remove using the whichMask and stopMask parameters. FlushEvents removes the low-level events specified by the whichMask parameter, up to but not including the first event of any type specified by the stopMask parameter.

If the event queue doesn't contain any of the events specified by the whichMask parameter, FlushEvents does not remove any events from the queue.

ASSEMBLY-LANGUAGE INFORMATION

You must set up register D0 with the event mask ( whichMask ) and stop mask before calling FlushEvents . When FlushEvents returns, register D0 contains 0 if all events were removed from the queue or, if all events were not removed from the queue, an event code that specifies the type of event that caused the removal process to stop.

Registers on entry

D0

Event mask (low-order word)

 

Stop mask (high-order word)

Registers on exit

D0

0 if all events were removed from the queue, or the event code of the event that stopped the search (low-order word)

SystemClick

After receiving a mouse-down event, your application should call the Window Manager function FindWindow (FindWindow) to determine where the cursor was when the mouse button was pressed. If FindWindow returns the inSysWindow constant, call the SystemClick function to handle the event.

pascal void SystemClick (const EventRecord *theEvent,
                                          WindowPtr theWindow);
theEvent
A pointer to the event record for the event.
theWindow
A reference to the window in which the mouse-down event occurred. Pass the window pointer returned by FindWindow in this parameter.

DESCRIPTION

If a mouse-down event occurred in a desk accessory's window, the SystemClick function determines which part of the desk accessory's window the cursor was in when the mouse button was pressed and routes the event to the appropriate desk accessory as necessary.

If the mouse button was pressed while the cursor was in the content region of the desk accessory's window and the window is active, SystemClick sends the mouse-down event to the desk accessory to process. If the mouse-down event occurred in the content region of the window and the window is inactive, SystemClick makes it the active window. It does this by sending your application an activate event to deactivate its front window and directing an event to the desk accessory to activate its window.

If the mouse button was pressed while the cursor was in the drag region or go-away region, SystemClick calls the Window Manager function DragWindow (DragWindow) or TrackGoAway (TrackGoAway) , as appropriate. If TrackGoAway reports that the user closed the desk accessory, SystemClick sends a close message to the desk accessory.

SEE ALSO

See "The Event Record" for a description of the fields in the event record.

SystemTask

In a multiple-application environment, the WaitNextEvent function WaitNextEvent is responsible for giving time to each open desk accessory or driver to perform any periodic action. You should not call SystemTask if your application calls WaitNextEvent .

If your application calls GetNextEvent (GetNextEvent) , your application should call the SystemTask function.

pascal void SystemTask (void);

DESCRIPTION

The SystemTask function gives time to each open desk accessory or driver to perform the periodic action defined for it. A desk accessory or device driver specifies how often the periodic action should occur, and SystemTask gives time to the desk accessory or device driver at the appropriate interval.

If your application calls GetNextEvent GetNextEvent , your application should call SystemTask at least every sixtieth of a second. This usually corresponds to calling SystemTask once each time through your event loop. If your application does a large amount of processing, you may need to call SystemTask more than once in your event loop.

SystemEvent

The WaitNextEvent WaitNextEvent and GetNextEvent GetNextEvent functions call the SystemEvent function. In most cases your application should not call the SystemEvent function.

The SystemEvent function determines if a specific event should be handled by the application or the Operating System.

pascal Boolean SystemEvent (const EventRecord *theEvent);
theEvent
A pointer to the event record for the event.

DESCRIPTION

SystemEvent returns false as its function result if the event should be handled by the application; otherwise, SystemEvent takes any appropriate actions and returns true .

For activate, update, mouse-up, and keyboard events (including keyboard equivalents of commands), SystemEvent checks to see whether the active window belongs to a desk accessory and whether that desk accessory can handle that type of event. If so, SystemEvent sends the event to the desk accessory and returns true . Otherwise, SystemEvent returns false .

For mouse-down events and null events, SystemEvent returns false .

For disk-inserted events, SystemEvent attempts to mount the disk using the PBMountVol function but returns false so that the application can perform further processing if necessary.

ASSEMBLY-LANGUAGE INFORMATION

If the SEvtEnb global variable (a byte) contains 0, SystemEvent always returns false .

SEE ALSO

See "The Event Record" for a description of the fields in the event record. For a description of the PBMountVol function, see the chapter "File Manager" in Inside Macintosh: Files .

GetOSEvent

The Toolbox Event Manager calls the GetOSEvent function to retrieve low-level events stored in the Operating System event queue. In most cases, your application should not use this function.

pascal Boolean GetOSEvent (EventMask mask, EventRecord *theEvent);
mask
A value that indicates which kinds of events are to be returned; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more values defined by the EventMask enumeration (Event Masks) . GetOSEvent returns only low-level events stored in the Operating System event queue; it does not return activate, update, operating-system, or high-level events. If no low-level event of any of the designated kinds is available, GetOSEvent returns a null event.
theEvent
A pointer to an event record for the next available low-level event of the specified type or types in the Operating System event queue. The GetOSEvent function removes the returned event from the Operating System event queue and returns the information about the event in an event record. The event record includes the type of event received and other information.

DESCRIPTION

The GetOSEvent function retrieves and removes an event from the Operating System event queue. GetOSEvent returns false as its function result if the event being returned is a null event; otherwise, GetOSEvent returns true . GetOSEvent does not intercept or respond to the event in any way. It also does not process Command-Shift- number key combinations or process any alarms set by the user through the Alarm Clock desk accessory.

ASSEMBLY-LANGUAGE INFORMATION

You must set up register A0 with the address of an event record and register D0 with the event mask before invoking GetOSEvent . When GetOSEvent returns, register D0 indicates whether the returned event is a null event or an event other than a null event and the returned event is accessible through register A0.

Registers on entry

A0

Address of event record

D0

Event mask (low-order word)

Registers on exit

A0

Address of event record

D0

0 if GetOSEvent returns any event other than a null event, or -1 if it returns a null event (low-order byte)

SEE ALSO

See "The Event Record" for a description of the fields in the event record.

OSEventAvail

The Toolbox Event Manager uses the OSEventAvail function to retrieve an event from the Operating System event queue without removing it. In most cases your application does not need to use this function.

pascal Boolean OSEventAvail (EventMask mask, EventRecord *theEvent);
mask
A value of type EventMask (eventMask) that indicates which kinds of events are to be returned; this parameter is interpreted as a sum of event mask constants. You specify the event mask using one or more values defined by the EventMask enumeration (Event Masks) . OSEventAvail returns only low-level events stored in the Operating System event queue; it does not return activate, update, operating-system, or high-level events. If no low-level event of any of the designated types is available, OSEventAvail returns a null event.
theEvent
A pointer to an event record for the next available event of the specified type or types. The OSEventAvail function does not remove the returned event from the Operating System event queue but does return information about the event in an event record. The event record includes the type of event received and other information.

DESCRIPTION

The OSEventAvail function retrieves an event from the Operating System event queue without removing it from the queue. The OSEventAvail function returns false as its function result if the event being returned is a null event; otherwise, OSEventAvail returns true .

OSEventAvail does not intercept or respond to the event in any way. It also does not process Command-Shift-number key combinations or process any alarms set by the user through the Alarm Clock desk accessory.

SPECIAL CONSIDERATIONS

If the OSEventAvail function returns a low-level event from the Operating System event queue, the event will not be accessible later if, in the meantime, the event queue becomes full and the event is discarded from it; however, this is not a common occurrence.

ASSEMBLY-LANGUAGE INFORMATION

You must set up register A0 with the address of an event record and register D0 with the event mask before invoking OSEventAvail . When OSEventAvail returns, register D0 indicates whether the returned event is a null event or some other event, and the returned event is accessible through register A0.

Registers on entry

A0

Address of event record

D0

Event mask (low-order word)

Registers on exit

A0

Address of event record

D0

0 if OSEventAvail returns any event other than a null event, or -1 if it returns a null event (low-order byte)

SEE ALSO

See "The Event Record" for a description of the fields in the event record

SetEventMask

The SetEventMask function sets the system event mask of your application to the specified mask. Your application should not call the SetEventMask function to disable any event types from being posted. Use SetEventMask only to enable key-up events if your application needs to respond to key-up events.

pascal void SetEventMask (EventMask value);
value
A value that specifies which events should be posted in the Operating System event queue. You specify the event mask using one or more of the values defined by the EventMask enumeration (Event Masks) .

DESCRIPTION

The SetEventMask function sets the system event mask of your application according to the parameter value . The Operating System Event Manager posts only low-level events (other than update or activate events) corresponding to bits in the system event mask of the current process when posting events in the Operating System event queue. The system event mask of an application is initially set to post mouse-up, mouse-down, key-down, auto-key, and disk-inserted events into the Operating System event queue.

ASSEMBLY-LANGUAGE INFORMATION

The system event mask of the current application is available in the SysEvtMask system global variable.

GetEvQHdr

The Event Manager uses the GetEvQHdr function to get a pointer to the header of the Operating System event queue. In most cases, your application should not call the GetEvQHdr function.

pascal QHdrPtr GetEvQHdr (void);

DESCRIPTION

The GetEvQHdr function returns a pointer to the header of the Operating System event queue.

ASSEMBLY-LANGUAGE NOTE

The EventQueue system global variable contains the header of the event queue.

SEE ALSO

See "The Event Queue" for information on the structure of the Operating System event queue.

LMSetEventQueue

pascal void LMSetEventQueue(QHdrPtr eventQueueValue);

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next